<?php
require('conn.php');
/**
 * 查询所有文章
 * @return void
 */
function showUserArticle($uName)
{
    $sql = "select a.*, b.board_name, u.uName, u.avatar, (select count(*) from tbl_article_like where article_id = a.article_id) as like_count from tbl_article as a join tbl_board as b on a.board_id = b.board_id join tbl_user as u on u.uid = a.uid where u.uName = '{$uName}' order by a.updated_time desc;";
    $GLOBALS['UserArticleArr'] = exec_select($sql);
}


/**
 * 通过用户名查询登录用户信息
 * @param string $uName 字符串类型，用户名
 * @return array  返回符合条件的用户
 */
function selectUserinfo($uName)
{
  $sql = "SELECT * FROM `tbl_user` WHERE uName='$uName'";
  return exec_select($sql)[0];
}
